package cdrprocessing.common.rules;

import java.io.Serializable;

public class DiscountForFailureRule extends AbstractRule implements Serializable {

    private final int numberOfCalls;

    public DiscountForFailureRule(int id, int numberOfCalls) {
        super("DiscountForFailureRule", id);
        this.numberOfCalls = numberOfCalls;
    }

    public int getNumberOfCalls() {
        return numberOfCalls;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = super.hashCode();
        result = prime * result + numberOfCalls;
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (!super.equals(obj))
            return false;
        if (getClass() != obj.getClass())
            return false;
        DiscountForFailureRule other = (DiscountForFailureRule) obj;
        if (numberOfCalls != other.numberOfCalls)
            return false;
        return true;
    }

    @Override
    public String toString() {
        return "DiscountForFailureRule [numberOfCalls=" + numberOfCalls + "]";
    }

}
